package com.hcms.admin.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hcms.admin.dto.SysRolePermissionTreeResponse;
import com.hcms.mybatis.entity.SysRole;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collection;
import java.util.List;

/**
 * <p>
 * 后台用户角色表 服务类
 * </p>
 *
 * @author achenxw@126.com
 * @since 2023-02-13
 */
public interface ISysRoleService extends IService<SysRole> {

    List<SysRole> getList(String keyword, Integer pageNum, Integer pageSize);

    SysRole getView(Long id);

    int createItem(SysRole role);

    int updateItem(Long id, SysRole role);

    int deleteItem(String ids);

    /**
     * 获取用户角色
     *
     * @param roleId
     * @return
     */
    List<SysRolePermissionTreeResponse> getRolePermissions(Long roleId);

    @Transactional
    boolean setRolePermissions(Long roleId, Collection<String> permissions);
}
